<template>
    <div>
        <table border="1" style="margin: auto;width: 50vw;">
            <thead><th>Order No</th><th>Title</th><th>Path</th><th>Operator</th></thead>
            <tbody v-for="(f,index) in list" v-bind:key="index">
                <tr>
                    <td>{{f.id}}</td>
                    <td>{{f.title}}</td>
                    <td><a :href='baseUrl+"/api/file/download?file="+f.file_path'>{{f.file_path}}</a></td>
                    <td><router-link :to="{path:'/edit',query:{id:f.id}}">Edit</router-link></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>
<script>
import axios from "axios";
export default {
    data(){
        return {
            baseUrl: axios.defaults.baseURL,
            list: []
        }
    },
    created(){
        axios.post('/api/file/list').then(res=>{
            if(res.status == "200"){
                this.list = res.data;
            }
        })
    }
}
</script>